package edu.cuit.avatar.loop;

import java.util.Scanner;

public class GuessNumber {
    public static void main(String[] args) {
        //生成0-100之间的随机数
        int number = (int)(Math.random() * 100);
        System.out.println("请猜一个100以内的数字......");
        Scanner input = new Scanner(System.in);
        int guess = input.nextInt();

        //当猜测的数值不等于number时，给用户提示范围
        while(guess != number){
//            if(guess < number)
//                System.out.println("小了");
//            else
//                System.out.println("大了");
            System.out.println(guess < number ? "小了" : "大了");
            guess = input.nextInt();
        }
        System.out.println("猜对了,该数为:" + number);
    }
}
